﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GzipManagerPro.IO
{
    public delegate void ArchiveMessageHandler(object sender, ArchiveMessageEventArgs e);

    public class ArchiveMessageEventArgs: EventArgs
    {
        public ArchiveMessageType Level { get; set; }
        public string Message { get; set; }
        public long TotalProgress { get; set; }
        public long CurrentProgress { get; set; }
        public double Percentage
        {
            get
            {
                return Math.Round((double)CurrentProgress * 100.0 / (double)TotalProgress, 2);
            }
        }

        public ArchiveMessageEventArgs(int totalProgress, int currentProgress, string message)
        {
            this.TotalProgress = totalProgress;
            this.CurrentProgress = currentProgress;
            this.Message = message;
            this.Level = ArchiveMessageType.ArchiveLevel;
        }

        public ArchiveMessageEventArgs(int totalProgress, int currentProgress, string message, params object[] parameters)
        {
            this.TotalProgress = totalProgress;
            this.CurrentProgress = currentProgress;
            this.Message = string.Format(message, parameters);
            this.Level = ArchiveMessageType.ArchiveLevel;
        }
    }

    public enum ArchiveMessageType: byte
    {
        ArchiveLevel,
        FileLevel
    }
}
